<template>
    <div>
        <keep-alive exclude="gamesDetail">
            <router-view/>
        </keep-alive>
        <!-- 导航 -->
        <app-nav>
            <h3>导航</h3>
        </app-nav>
    </div>
</template>

<script>
import appNav from '@/components/app-nav.vue'

export default {
    name: "Home",
    components: {
        appNav
    },
    beforeRouteEnter(to, from, next) {
        // 如果检测到未登录，将无法进入主页
        if (localStorage.getItem('userInfo')) {
            next();
        } else {
            next({path:'/login'});
        }
    }
}
</script>

<style lang="scss" scoped>

</style>
